package com.ocom.payconfig.controller;

import com.ocom.common.constant.PayConfigUrl;
import com.ocom.common.entity.payconfig.EntityRestStaff;
import com.ocom.common.request.payconfig.staff.GetRestStaffListRequest;
import com.ocom.common.request.payconfig.staff.RemoveRestStaffRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.payconfig.service.RestStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RestStaffController {


    @Autowired
    RestStaffService restStaffService;

    //11.11.1餐厅职工列表（getRestStaffList）
    @PostMapping(PayConfigUrl.Url_getRestStaffList)
    public Result getRestStaffList(@RequestBody GetRestStaffListRequest request) {

        return ResultUtil.success(restStaffService.getList(request.getComId(), request));
    }

    //11.11.2删除餐厅职工（removeRestStaff）
    @PostMapping(PayConfigUrl.Url_removeRestStaff)
    public Result removeRestStaff(@RequestBody RemoveRestStaffRequest request) {
        restStaffService.removeRestStaff(request.getComId(), request);

        return ResultUtil.success();
    }

    //11.11.3增加餐厅职工（newRestStaff）
    @PostMapping(PayConfigUrl.Url_newRestStaff)
    public Result newRestStaff(@RequestBody EntityRestStaff entityRestStaff) {
        restStaffService.newRestStaff(entityRestStaff.getComId(), entityRestStaff);

        return ResultUtil.success();
    }

    //11.11.4修改餐厅职工（updateRestStaff）
    @PostMapping(PayConfigUrl.Url_updateRestStaff)
    public Result updateRestStaff(@RequestBody EntityRestStaff entityRestStaff) {

        restStaffService.updateRestStaff(entityRestStaff.getComId(), entityRestStaff);

        return ResultUtil.success();
    }

}
